refactor: move torch/deepfilternet to optional [full] extra#97
refactor: move torch/deepfilternet to optional [full] extra#97zh-plus merged 1 commit intozh-plus:masterfrom
Conversation
|
Hi @zh-plus, this PR is the concrete implementation of the dependency decoupling in #88. The core change is simple: torch, torchaudio, and deepfilternet move from required dependencies to The change is non-breaking for the default install path: all existing code works identically without any modifications. Only users who explicitly pass On versioning: since the default install surface changes (fewer packages installed), would you prefer to release this as 1.7.0, or 1.6.3 given that no code behavior changes for the default path? |
|
Thanks for the cleanup here. The dependency split looks good overall, and I’m fine merging this PR. I did notice two small follow-up items:
I’ll handle those separately, so they’re not blocking this PR. Happy to merge. |
Move torch/deepfilternet to optional
[full]extraMotivation
torch, torchaudio, and deepfilternet (~2GB+) are only used in the noise suppression path (
noise_suppress=True), which is off by default. Everypip install openlrccurrently pulls in these heavy dependencies even though most users only need transcription and translation.Additionally,
torchvisionis declared as a dependency but never imported anywhere in the codebase.Changes
pyproject.tomltorch,torchaudio, anddeepfilternetfromdependenciesto a new[project.optional-dependencies] fullextra.torchvisionentirely (unused).openlrc/preprocess.pyimport torchandfrom df.enhance import ...innoise_suppression()with atry/except ImportErrorthat raises a clear message:"Install them with: pip install openlrc[full]".openlrc/utils.pyrelease_memory()gracefully handle missing torch (return early instead of crashing).import torchfromTYPE_CHECKINGblock..github/workflows/ci.ymluv run python -m unittesttouv run --extra full python -m unittestso CI continues to test the full feature set including noise suppression.README.mdpip install openlrc[full]for noise suppression.noise_suppress=Truecode example with(requires openlrc[full]).Migration
pip install openlrcpip install openlrc[full]Existing users who rely on
noise_suppress=Trueneed to change their install command topip install openlrc[full].